<?php 
defined('_JEXEC') or die;

// disable core styles to avoid bs conflict 
OC_Util::$core_styles = array();

$keyword = JRequest::getString('q', '');
$job_id=JRequest::getInt('job_id',0);
$oldjobid=JRequest::getInt('oldjobid',0);
?>

<div class="dialogp_content">
   <div class="searchaction">
      <span class="medium">搜索：</span>
      <div class="dialogsearchbg clearfix">
         <input type="text" value="<?=$keyword?>" class="pull-left search_input"/>
         <a href="<?=(OC_Helper::linkToRoute('resumes_joblist',array('alljobs'=>1)) . '&q=%q')?>" class="pull-right search_btn"></a>
      </div>
      <span class="medium"><a href="javascript:;" id="clear_search">重置</a></span>
   </div>
   
   <?php if(count($_['jobcitylist']) >= 2): ?>
   <div class="cityselect medium songti">
      <?php 
      list($href, $selected) = PResumesHelper::getSearchItemHref($_['cityPageUrl'], 'jc', 'all');
      ?>
      <b>按地区</b>：<a href="<?=($selected ? 'javascript:;' : $href)?>" class="displaylist <?=($selected ? 'cur_a'  : '')?>">全部</a>
      <?php 
      if(isset($_['jobcitylist']) && !empty($_['jobcitylist'])) {
         foreach ($_['jobcitylist'] as $jobcity) {
            list($href, $selected) = PResumesHelper::getSearchItemHref($_['cityPageUrl'], 'jc', $jobcity['cityid']);
      ?>
      <a href="<?=($selected ? 'javascript:;' : $href)?>" class="displaylist <?=($selected ? 'cur_a'  : '')?>"><?php echo ProvinceHelper::getMuniProvinceId($jobcity['cityid']) ? $jobcity['province'] : $jobcity['province'] . $jobcity['city']?></a>
      <?php 
         }
      }
      ?>
   </div>
   <?php endif; ?>
   
   <?php if(count($_['jobikeylist']) >= 2): ?>
   <div class="selectletter medium">
      <?php 
      list($href, $selected) = PResumesHelper::getSearchItemHref($_['ikeyPageUrl'], 'ik', 'all');
      ?>
      <b>按拼音</b>：<a href="<?=($selected ? 'javascript:;' : $href)?>" class="displaylist <?=($selected ? 'cur_a'  : '')?>">全部</a>
      <?php 
      if(isset($_['jobikeylist']) && !empty($_['jobikeylist'])) {
         foreach ($_['jobikeylist'] as $jobikey) {
            list($href, $selected) = PResumesHelper::getSearchItemHref($_['ikeyPageUrl'], 'ik', $jobikey);
      ?>
      <a href="<?=($selected ? 'javascript:;' : $href)?>" class="displaylist <?=($selected ? 'cur_a'  : '')?>" ><?=strtoupper($jobikey == 'other' ? '其他' : $jobikey)?></a>
      <?php 
         }
      }
      ?>
   </div>
   <?php endif; ?>
   
   <div class="itemlist">
   <?php if (empty($_['jobList'])): ?>
   <div class="postionlisttable_nodata large yahei" style="text-align: center;">没有对应的职位</div>
   <?php else: ?>
   <div class="postionlisttable medium">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
         <tr>
            <?php 
            $n=count($_['jobList']);
            for ($i=0; $i < $n; $i++) {
               $job = $_['jobList'][$i];
               if ($i != 0 && ($i%3) == 0) {
                  echo '</tr><tr>';
               }
               list($href, $selected) = PResumesHelper::getSearchItemHref($_['searchUrl'], 'jobid', $job_id);
            ?>
            <td width="33%"><a href="javascript:;"  class="link <?=($job_id== $job['id']? 'cur_a'  : '')?> selectjob" data-jobid="<?=$job['id']?>" data-jobtitle="<?=$job['job_title']?>"><?=$job['job_title']?></a></td>
            <?php 
            }
            
            $filledNum = 3 - ($n%3);
            if ($filledNum < 3) {
               for ($i=0; $i < $filledNum; $i++) {
                  echo '<td width="33%"></td>';
               }
            }
            ?>
         </tr>
      </table>
   </div>
   <?php endif; ?>
   </div>
   <div class="action_sltjobs">
   	<span class="error server"></span>
      <?php if(!$oldjobid):?>
      <a href="javascript:;" class="btn selectjobcancel" id="selectjobcancel">取消选择</a>
      <?php endif;?>
      <a href="javascript:;" id="selectjobconfirm" class="btn btn-info selectjobconfirm">确认</a>
   </div>
</div>